<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SpringMVC 架构深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* 首字下沉效果 */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #4f46e5;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* 代码块美化 */
        pre {
            background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
            border-radius: 12px;
            padding: 1.5rem;
            overflow-x: auto;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            position: relative;
        }
        
        pre::before {
            content: '';
            position: absolute;
            top: 0.75rem;
            left: 1rem;
            width: 12px;
            height: 12px;
            background: #ef4444;
            border-radius: 50%;
            box-shadow: 20px 0 0 #eab308, 40px 0 0 #22c55e;
        }
        
        code {
            color: #e2e8f0;
            font-family: 'Fira Code', 'Consolas', monospace;
            font-size: 0.9rem;
            line-height: 1.6;
        }
        
        /* 卡片悬停效果 */
        .feature-card {
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        /* 标题装饰线 */
        .section-title::after {
            content: '';
            display: block;
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #4f46e5 0%, #7c3aed 100%);
            margin-top: 1rem;
            border-radius: 2px;
        }
        
        /* 引用样式 */
        .quote-box {
            position: relative;
            padding-left: 3rem;
        }
        
        .quote-box::before {
            content: '\f10d';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            position: absolute;
            left: 0;
            top: -0.5rem;
            font-size: 2rem;
            color: #4f46e5;
            opacity: 0.3;
        }
        
        /* 列表项美化 */
        .custom-list li {
            position: relative;
            padding-left: 2rem;
            margin-bottom: 1rem;
        }
        
        .custom-list li::before {
            content: '\f054';
            font-family: 'Font Awesome 6 Free';
            font-weight: 900;
            position: absolute;
            left: 0;
            top: 0.25rem;
            color: #4f46e5;
            font-size: 0.75rem;
        }
        
        /* 渐变文字 */
        .gradient-text {
            background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        /* Mermaid 图表样式 */
        .mermaid {
            background: white;
            border-radius: 12px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }
    </style>
</head>
<body>
    <!-- Hero 区域 -->
    <section class="relative overflow-hidden bg-gradient-to-br from-indigo-600 via-purple-600 to-pink-500 text-white">
        <div class="absolute inset-0 bg-black opacity-20"></div>
        <div class="relative container mx-auto px-6 py-24">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-5xl md:text-7xl font-bold mb-6 animate-pulse">
                    SpringMVC 架构深度解析
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">
                    探索企业级 Web 框架的核心设计理念与实现原理
                </p>
                <div class="flex justify-center space-x-6 text-sm">
                    <span class="flex items-center">
                        <i class="fas fa-clock mr-2"></i>
                        阅读时间：15分钟
                    </span>
                    <span class="flex items-center">
                        <i class="fas fa-layer-group mr-2"></i>
                        深度：高级
                    </span>
                    <span class="flex items-center">
                        <i class="fas fa-code mr-2"></i>
                        包含源码解析
                    </span>
                </div>
            </div>
        </div>
        <div class="absolute bottom-0 left-0 right-0">
            <svg viewBox="0 0 1440 120" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path d="M0 120L60 110C120 100 240 80 360 70C480 60 600 60 720 65C840 70 960 80 1080 85C1200 90 1320 90 1380 90L1440 90V120H1380C1320 120 1200 120 1080 120C960 120 840 120 720 120C600 120 480 120 360 120C240 120 120 120 60 120H0V120Z" fill="white"/>
            </svg>
        </div>
    </section>

    <!-- 主要内容区域 -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        
        <!-- 架构概览卡片 -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <h2 class="text-3xl font-bold mb-6 section-title">架构概述</h2>
                <p class="text-lg text-gray-700 leading-relaxed drop-cap">
                    SpringMVC 是 Spring 框架的一个重要组成部分，是一个基于请求驱动的框架，用于处理 Web 请求。SpringMVC 基于<strong class="text-indigo-600">前端控制器模式</strong>，所有的请求都通过 <code class="bg-gray-100 px-2 py-1 rounded text-sm">DispatcherServlet</code> 进行分发。这种设计模式使得 SpringMVC 具有高度的灵活性和可扩展性，成为企业级 Java Web 开发的首选框架之一。
                </p>
                
                <!-- 架构图 -->
                <div class="mt-8">
                    <div class="mermaid">
                        graph TB
                            A[客户端请求] -->|HTTP Request| B[DispatcherServlet]
                            B --> C[HandlerMapping]
                            C -->|查找Handler| D[Controller]
                            B --> E[HandlerAdapter]
                            E -->|调用Handler| D
                            D -->|返回ModelAndView| F[ViewResolver]
                            F -->|解析视图| G[View]
                            G -->|渲染| H[响应客户端]
                            
                            style A fill:#f9f,stroke:#333,stroke-width:2px
                            style B fill:#bbf,stroke:#333,stroke-width:4px
                            style D fill:#bfb,stroke:#333,stroke-width:2px
                            style H fill:#f9f,stroke:#333,stroke-width:2px
                    </div>
                </div>
            </div>
        </section>

        <!-- 核心组件网格 -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 text-center gradient-text">核心组件解析</h2>
            <div class="grid md:grid-cols-2 gap-8">
                
                <!-- DispatcherServlet 卡片 -->
                <div class="feature-card bg-white rounded-xl shadow-lg p-8">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-traffic-light text-indigo-600 text-xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold">DispatcherServlet</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        作为 SpringMVC 的核心，DispatcherServlet 扮演着前端控制器的角色，负责接收所有 HTTP 请求并将它们分发给相应的处理器。
                    </p>
                    <div class="quote-box text-sm text-gray-600 italic">
                        它就像一个智能的交通指挥官，确保每个请求都能找到正确的处理路径。
                    </div>
                </div>

                <!-- HandlerMapping 卡片 -->
                <div class="feature-card bg-white rounded-xl shadow-lg p-8">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-purple-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-map-marked-alt text-purple-600 text-xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold">HandlerMapping</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        HandlerMapping 负责根据请求 URL 查找对应的处理器。它维护着 URL 模式与控制器方法之间的映射关系。
                    </p>
                    <ul class="custom-list text-sm text-gray-600">
                        <li>支持多种映射策略</li>
                        <li>灵活的 URL 模式匹配</li>
                        <li>注解驱动的配置方式</li>
                    </ul>
                </div>

                <!-- HandlerAdapter 卡片 -->
                <div class="feature-card bg-white rounded-xl shadow-lg p-8">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-green-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-plug text-green-600 text-xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold">HandlerAdapter</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        HandlerAdapter 是适配器模式的典型应用，它将不同类型的处理器统一适配为 SpringMVC 可以调用的标准接口。
                    </p>
                    <div class="bg-gray-50 rounded-lg p-4 text-sm">
                        <strong>核心职责：</strong>参数解析、方法调用、结果封装
                    </div>
                </div>

                <!-- ViewResolver 卡片 -->
                <div class="feature-card bg-white rounded-xl shadow-lg p-8">
                    <div class="flex items-center mb-4">
                        <div class="w-12 h-12 bg-pink-100 rounded-lg flex items-center justify-center mr-4">
                            <i class="fas fa-eye text-pink-600 text-xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold">ViewResolver</h3>
                    </div>
                    <p class="text-gray-700 mb-4">
                        ViewResolver 负责将逻辑视图名解析为具体的视图实现，支持 JSP、Thymeleaf、FreeMarker 等多种视图技术。
                    </p>
                    <div class="flex items-center text-sm text-gray-600">
                        <i class="fas fa-info-circle mr-2 text-blue-500"></i>
                        支持视图名前缀和后缀的灵活配置
                    </div>
                </div>
            </div>
        </section>

        <!-- 源码解析部分 -->
        <section class="mb-16">
            <div class="bg-gradient-to-r from-gray-900 to-gray-800 rounded-2xl p-8 md:p-12 text-white">
                <h2 class="text-3xl font-bold mb-8 flex items-center">
                    <i class="fas fa-code mr-4"></i>
                    核心源码深度解析
                </h2>
                
                <!-- DispatcherServlet 源码 -->
                <div class="mb-12">
                    <h3 class="text-2xl font-semibold mb-4">DispatcherServlet 请求分发机制</h3>
                    <p class="mb-6 text-gray-300">
                        DispatcherServlet 的 service 方